<template>
  <div style="padding-bottom: 336px; " class="container-big wing-blank dingtalk-my-ticket-page">
    <h3 class="my-ticket-title">
      我的门票
    </h3>
    <!-- isActive 0未激活1已激活5已转赠成功 -->
    <ucan-ticket @click="goDetail(ticket)" v-if="ticket.isActive==1||ticket.isActive==5" :imgUrl="ticket.imgUrl" :state="ticket.state" :isDel="ticket.isDel" :activityTitle="ticket.activityTitle" :source="ticket.source" :transferTicketId="ticket.transferTicketId" :isActive="ticket.isActive" v-for="(ticket, index) in tickets" :key="index" :id="ticket.ticketId" :name="ticket.uName" :type="ticket.tTypeName" :address="ticket.address" :price="ticket.price" :activityId="ticket.activityId" :ticketTypeId="ticket.ticketTypeId" :cloneOperationBtn="true" :activeTime="{stime: ticket.stime, etime: ticket.etime, activeDate: ticket.activeDate}" />
    <bottomNav></bottomNav>
  </div>
</template>
<script>
import dd from "dingtalk-jsapi";
import UcanTicket from "./ucan-ticket";
import services from "../../api/mine";
import bottomNav from "./bottomNav";
import ddApi from "./ddApi";

export default {
  data() {
    return {
      tickets: []
    };
  },
  async mounted() {
    ddApi.setRight();
    const [tickets] = await Promise.all([services.getTicketList()]);

    this.tickets = tickets;
    for (let i = 0; i < tickets.length; i++) {
      if (tickets[i].activityTitle) {
        sessionStorage.setItem("activityTitle", tickets[i].activityTitle);
      }
    }
  },
  methods: {
    goDetail(ticket) {
      console.log(ticket);

      this.$router.push({
        path: "/mine/ticket",
        query: {
          ticketId: ticket.ticketId,
          ticketTypeId: ticket.ticketTypeId,
          activityId: ticket.activityId
        }
      });
    }
  },
  components: {
    UcanTicket,
    bottomNav
  }
};
</script>
<style lang="less">
.dingtalk-my-ticket-page {
  padding-top: 56px;
  padding-bottom: 30px;
  .ucan-ticket-logo {
    width: 201px;
    display: block;
  }

  .uncan-user-avatar {
    width: 170px;
    height: 170px;
    margin: 46px auto 36px;
    position: relative;
    > img {
      width: 100%;
      height: 100%;
      border-radius: 50%;
    }
  }
  .uncan-user-avatar-badge {
    padding: 0 18px;
    height: 38px;
    font-size: 20px;
    line-height: 38px;
    text-align: center;
    background-image: linear-gradient(-116deg, #3cb9ff 0%, #6044d4 100%);
    border-top-right-radius: 19px;
    border-bottom-right-radius: 19px;
    border-bottom-left-radius: 19px;
    white-space: nowrap;
    position: absolute;
    right: -80px;
    bottom: 0;
  }

  .ucan-user-name {
    font-size: 34px;
    text-align: center;
    margin-bottom: 44px;
  }

  .uncan-ticket-authentications {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }

  .uncan-ticket-auth {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex: 1;
    height: 106px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 16px 0px 16px 24px;
    margin-right: 16px;
    &:last-child {
      margin-right: 0;
    }
  }

  .uncan-ticket-auth-icon {
    width: 48px;
    height: 48px;
    margin-right: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .uncan-ticket-auth-title {
    font-size: 28px;
    color: #fff;
    text-align: left;
  }
  .uncan-ticket-auth-desc {
    font-size: 20px;
    text-align: left;
    color: rgba(238, 238, 238, 0.6);
    white-space: nowrap;
    margin-top: 6px;
  }

  .my-ticket-title {
    font-size: 32px;
    color: #eeeeee;
    text-align: left;
    margin-top: 54px;
    margin-bottom: 24px;
  }

  .uncan-my-schedule {
    margin-top: 48px;
  }
}

.ticket-auth-dialog {
  width: 638px;
  border-radius: 4px;
  position: relative;
  .co-dialog-body {
    padding: 0;
  }

  .ticket-auth-avatar {
    width: 307px;
    display: block;
    margin: 10px auto 0;
  }
}

.ticket-auth-dialog-header {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  height: 468px;
  background: url(https://gw.alicdn.com/tfs/TB1XIkLHgTqK1RjSZPhXXXfOFXa-638-515.png)
    no-repeat;
  background-size: cover;
  width: 100%;
}

.ticket-auth-dialog-title {
  padding: 32px 0;
  text-align: center;
  font-size: 36px;
  color: #fff;
  font-weight: normal;
}

.ticket-auth-dialog-close {
  position: absolute;
  right: 24px;
  top: 24px;
  color: #fff;
}

.ticket-auth-dialog-content {
  padding: 32px;
  color: #333;
  font-size: 28px;
  line-height: 1.6;
  .argeement-desc {
    color: #888;
    margin-top: 24px;
    > a {
      color: #108ee9;
    }
  }
}

.ticket-auth-dialog-action {
  height: 102px;
  line-height: 101px;
  border-top: 1px solid #e5e5e5;
  color: #108ee9;
  font-size: 36px;
  display: block;
  width: 100%;
  text-align: center;
}
</style>

